@(qcms: List[Qcm], q: Qcm, msgErreur: String) 
@import helper._ 


@main("Qcm List") {



<h2> <p class="text-info"> Titre a rajouter : @qcms.size() qcm(s) </p></h2>

<table class="table table-condensed">
	 
            <thead>
            	<tr>
            		<th></th>
                    <th><h5>Libelle</h5></th>
                    <th><h5>Createur</h5></th>
                    <th><h5>Statut</h5></th>
                </tr>
            </thead>
            <tbody>
            
      <div class="accordion" id="accordion2">
		@for(qcm <- qcms) {	
		<form method="post" action="@routes.PasserQCM.authentificationQcm()">
		@if(qcm.getStatut() == "Ouvert" || qcm.getStatut() == "A venir"){	
			
			<tr>			
		    	  <div class="accordion-heading">
		    		<td width = 20>
		      			<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse@qcm.getIdQcm()">
		        		<i class="icon-search" size="small"/></i>
		      			</a>
		     		</td>
		      		<td>
		     			 <p class="text-info"> @qcm.getLibelle() </p>
		      		</td>
		      		<td>
		      			@qcm.getUser().getNom()
		      		</td>
		      		<td>
		      			@if(qcm.getStatut() == "Ouvert"){
							<font color="green"> <strong> @qcm.getStatut() </strong></font>
						}else{
							<font color="orange"> @qcm.getStatut() </font>
						}
		      		</td>
		    	  </div>	
		   	</tr>
		    <tr> 
				<td colspan="5">
				@if(qcm.getIdQcm() == q.getIdQcm() && msgErreur != ""){
		    	<div id="collapse@qcm.getIdQcm()" class="accordion-body collapse in">
		    	}else{
		    	<div id="collapse@qcm.getIdQcm()" class="accordion-body collapse">
		    	}	    	
		      		<div class="accordion-inner">
		      		
							<div class="controls controls-row">
							<div class="span4" >
						 	Creation : @qcm.getDateCreation().format("dd/MM/yyyy HH:mm")<br>
						 	Ouverture : @qcm.getDateOuverture().format("dd/MM/yyyy HH:mm")<br>
						 	Fermeture : @qcm.getDateCloture().format("dd/MM/yyyy HH:mm")<br>
						 	</div>
						 	<div class="span4" >
							Nombre de questions : @qcm.getListeQuestions().size()<br>
						 	Duree Approx : @(qcm.getListeQuestions().size()*3) min<br>
						 	</div>
						 	<div class="span3" >
						 	
						 	@if(qcm.getStatut() == "Ouvert"){
						 	 <input  name="idQcm" type="hidden" value="@qcm.getIdQcm()">
						 	
						 		@if(UserQcm.findByIds(qcm.getIdQcm(),Long.parseLong(session.get("id"))) == null){
						 		<div class="input-append">
  									<input class="span2" name="cleQcm" type="text" placeholder="Saisir la cle ">
  									 <button type="submit" class="btn btn-primary">Go</button>
  					
								</div>
									@if(qcm.getIdQcm() == q.getIdQcm() && msgErreur != ""){
									<br>
									<font color="red">  @msgErreur </font>
									}
								}else{
									<div class="input-append">
  									<input class="span2" id="appendedInputButton" type="text" value="QCM deja realise" disabled="disabled"> 
  									<button type="submit" class="btn btn-primary">Go</button>
								</div>
								}
							}
							@if(qcm.getStatut() == "A venir"){
							}
							
						 	</div>
						 	</div>
		      		</div>
		    	</div>
		    	</td>
		    
		    </tr>
		 }
 	</form>
	}
	</body>
	</div>
</table>

   <a class="btn btn-primary" href="@routes.Application.redirectionAccueil()">Menu principal <i class="icon-white icon-circle-arrow-right"></i></a>
     
}
